package com.zmzncs.lmtc.module.promotion.controller;


import com.zmzncs.lmtc.common.pojo.Rest;
import com.zmzncs.lmtc.common.util.JsonUtil;
import com.zmzncs.lmtc.common.util.RestUtil;
import com.zmzncs.lmtc.module.promotion.pojo.reserve_fee_scale.ReserveFeeScale;
import com.zmzncs.lmtc.module.promotion.pojo.reserve_fee_scale.ReserveFeeScaleDTO;
import com.zmzncs.lmtc.module.promotion.pojo.reserve_fee_scale.ReserveFeeScaleVO;
import com.zmzncs.lmtc.module.promotion.service.ReserveFeeScaleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 促销-预约规则的时段预约费 前端控制器
 * </p>
 *
 * @author 高博文
 * @since 2020-12-14
 */
@Api(tags = "预约收费标准")
@RestController
@RequestMapping("/promotion/reserve-fee-scale")
public class ReserveFeeScaleController {

    @Autowired
    ReserveFeeScaleService reserveFeeScaleService;

    @ApiOperation(value = "根据停车场id查询收费标准")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType="query", name="parkId", value="停车场id", required = true),
    })
    @GetMapping(value = "getMonthRulePaytypeByParkId")
    public Rest<List<ReserveFeeScaleDTO>> getByParkId(Long parkId) {
        List<ReserveFeeScaleDTO> reserveFeeScaleDTOList = reserveFeeScaleService.getByParkId(parkId);
        List<ReserveFeeScaleVO> reserveFeeScaleVOList = JsonUtil.listTransform(reserveFeeScaleDTOList, ReserveFeeScaleVO.class);

        return RestUtil.success(reserveFeeScaleVOList);
    }

}

